﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SDT.Site.ViewModels.ArticleListViewModel>" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>
<%if(Model.Articles !=null && Model.Articles.Count>0){
    var first = Model.Articles[0]; %>
<div class="t_img">
    <a href="/article/details/<%=first.ID %>/<%=Html.ToUrlFriendly(first.Title)%>">
        <% string imgPath = (first.ImagePath != null && first.ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(first.ID, 362, 278, first.ImagePath, Model.ImagePath, Model.RootImageUrl) : SDT.Lib.Common.Globals.DefaultLogo; %>
        <img src="<%=imgPath %>" title="<%=first.Title %>" alt="<%=first.Title %>" class="bor_img" width="362" height="278" style="overflow:hidden"/>
    </a>
</div>
<div class="t_cnt">
    <%
    if (Model.Articles.Count > 1)
    {
        var count = Model.Articles.Count <= 4 ? Model.Articles.Count : 4;
        for (int i = 1; i < count; i++)
        {
            string imgPath1 = (Model.Articles[i].ImagePath != null && Model.Articles[i].ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(Model.Articles[i].ID, 104, 77, Model.Articles[i].ImagePath, Model.ImagePath, Model.RootImageUrl) : SDT.Lib.Common.Globals.DefaultLogo;
            %>
            <div style="float: left; width: 109px;">
                <a href="/article/details/<%=Model.Articles[i].ID %>/<%=Html.ToUrlFriendly(Model.Articles[i].Title)%>"><img width="104" height="77" class="bor_img" src="<%=imgPath1 %>" title="<%=Model.Articles[i].Title %>" alt="<%=Model.Articles[i].Title %>" /></a>
            </div>
            <div style="float: left; width: 180px; margin-left: 10px;">
                <a href="/article/details/<%=Model.Articles[i].ID %>/<%=Html.ToUrlFriendly(Model.Articles[i].Title)%>"><strong><%=Html.Encode(Model.Articles[i].Title)%></strong></a>
            </div>
            <div class="clear"></div>
            <%if (i < count - 1)
              { %>
            <div class="line_dot"></div>   
            <%}
        }%>
    <%} %>
       
</div>
<div class="clear"></div>
<h2><a href="/article/details/<%=first.ID %>/<%=Html.ToUrlFriendly(first.Title)%>" class="gr"><%=Html.Encode(first.Title)%></a></h2>
<p><%=Html.Encode(first.Summary)%></p>
<div class="t_list_l">
    <div class="new_list">
        <%var total = Model.Articles.Count - 4;
          int totaRight = total / 2;
          int totalLeft = total -totaRight;
          if (totalLeft > 0)
        { %>
   	    <ul>
       	  <%for (int i = 4; i < totalLeft+4; i++)
            {
             %>
       	    <li><a href="/article/details/<%=Model.Articles[i].ID %>/<%=Html.ToUrlFriendly(Model.Articles[i].Title)%>"><%=Html.Encode(Model.Articles[i].Title)%></a></li>              
           <%} %>
        </ul>
      <%} %>
    </div>
</div>
<div class="t_list_r">
    <div class="new_list">
        <%if (totaRight > 0)
        { %>
   	    <ul>
       	  <%for (int i = 4 + totalLeft; i < Model.Articles.Count; i++)
            {
             %>
       	    <li><a href="/article/details/<%=Model.Articles[i].ID %>/<%=Html.ToUrlFriendly(Model.Articles[i].Title)%>"><%=Html.Encode(Model.Articles[i].Title)%></a></li>              
           <%} %>
        </ul>
      <%} %>
    </div>
</div>
<div class="clear"></div>
<%} %>
